<template>
  <div class="search">
    <f-form ref="form" :action="api.bai" :form-key="this.formItem.undefined" >
      <f-form-item label="主键"  name="applyInvoiceId" dataType="${formField.dataType}"   :value="formItem.applyInvoiceId" />
      <f-form-item label="申请人Id"  name="applyUserId" dataType="${formField.dataType}"   :value="formItem.applyUserId" />
      <f-form-item label="用户产品Id"  name="userGoodsId" dataType="${formField.dataType}"   :value="formItem.userGoodsId" />
      <f-form-item label="发票类型（1电子发票，2专票,3普票）"  name="invoiceType" dataType="number"   :value="formItem.invoiceType" />
      <f-form-item label="抬头类型"  name="invoiceTitleType" dataType="number"   :value="formItem.invoiceTitleType" />
      <f-form-item label="抬头名称"  name="invoiceTitleName" dataType="${formField.dataType}"   :value="formItem.invoiceTitleName" />
      <f-form-item label="开票金额"  name="invoiceAmount" dataType="${formField.dataType}"   :value="formItem.invoiceAmount" />
      <f-form-item label="开票状态（0待开票,1已开票）"  name="invoiceState" dataType="number"   :value="formItem.invoiceState" />
      <f-form-item label="开票日期"  name="invoiceDate" dataType="${formField.dataType}"   :value="formItem.invoiceDate" />
      <f-form-item label="开票信息"  name="invoiceRemark" dataType="${formField.dataType}"   :value="formItem.invoiceRemark" />
      <f-form-item label="是否删除"  name="deleted" dataType="number"   :value="formItem.deleted" />
      <f-form-item label="更新人"  name="updateUser" dataType="${formField.dataType}"   :value="formItem.updateUser" />
      <f-form-item label="更新时间"  name="updateTime" dataType="${formField.dataType}"   :value="formItem.updateTime" />
      <f-form-item label="创建人"  name="createUser" dataType="${formField.dataType}"   :value="formItem.createUser" />
      <f-form-item label="创建时间"  name="createTime" dataType="${formField.dataType}"   :value="formItem.createTime" />
    </f-form>
  </div>
</template>
<script>
  import api from './js/api'
  export default {
    name: 'baiForm',
    props: {},
    data() {
      return {
        refs:this.$refs,
        api:  Object.assign(api, this.api),
        isAdd: true,//是否是添加模式
        loaded: false,//是否加载完成
        formItem: this.getFormItem()
      }
    },
    methods: {
      getFormItem() {
        return {
          undefined: '',
          applyInvoiceId: '',
          applyUserId: '',
          userGoodsId: '',
          invoiceType: '',
          invoiceTitleType: '',
          invoiceTitleName: '',
          invoiceAmount: '',
          invoiceState: '',
          invoiceDate: '',
          invoiceRemark: '',
          deleted: '',
          updateUser: '',
          updateTime: '',
          createUser: '',
          createTime: ''
        }
      },
      //表单赋值
      setData(data) {
        this.$refs.form.resetFields()
        this.formItem = this.getFormItem()
        if (data && data.undefined) {
          let params={
              undefined:data.undefined
          }
          this.refs['form'].getDetails(params,(data)=>{
             this.formItem=data
             this.loaded = true
          })
          this.isAdd = false
        } else {
          this.loaded = true
        }
      },
      //提交表单
      handleSubmit(callback) {
        this.$refs.form.submit({  }, callback)
      }
    },
    created() {
    },
    components: {}
  }
</script>

<style scoped lang="less" rel="stylesheet/less">

</style>
